/**
 * 
 */
package cen5501c.common;

import java.util.ArrayList;
import java.util.List;

/**
 * Client code can show an exception in its own code to the user.
 * 
 * The format is:
 * <LOCALERROR: explanation of exception>
 * 
 * Note: This isn't really a command but has similar format so define it as a command.
 * 
 * @author Jiangyan Xu
 *
 */
public class LocalErrorCmd extends CmdBase {

	public static final String OPERATION = "LOCALERROR";
	private String message;

	/**
	 * 
	 */
	public LocalErrorCmd() {
	}

	/**
	 * @param args
	 * @throws Exception
	 */
	public LocalErrorCmd(List<String> args) throws Exception {
		super(args);
	}

	/* (non-Javadoc)
	 * @see cen5501c.common.CmdBase#fillArgs(java.util.List)
	 */
	@Override
	protected void fillArgs(List<String> args) {
		message = args.get(0);
	}

	/* (non-Javadoc)
	 * @see cen5501c.common.CmdBase#getArgList()
	 */
	@Override
	public List<String> getArgList() {
		List<String> ret = new ArrayList<String>();
		ret.add(message);
		return ret;
	}

	/* (non-Javadoc)
	 * @see cen5501c.common.CmdBase#getOperation()
	 */
	@Override
	public String getOperation() {
		return OPERATION;
	}

	/**
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * @param message the message to set
	 */
	public void setMessage(String message) {
		this.message = message;
	}

}
